using EFCore.Model;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;

namespace Exerciese.Model.model
{
    public partial class Crowd_Funding : DbContext
    {
        public Crowd_Funding()
        {

        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 
        {
            optionsBuilder.UseSqlServer(StaticConstraint.Crowd_FundingString);

            optionsBuilder.UseLoggerFactory(new LogFactory());
        }

        

        public virtual DbSet<T_Accomplish> T_Accomplish { get; set; }
        public virtual DbSet<T_Administrator_User> T_Administrator_User { get; set; }
        public virtual DbSet<T_AttenTion> T_AttenTion { get; set; }
        public virtual DbSet<T_Information> T_Information { get; set; }
        public virtual DbSet<T_Project> T_Project { get; set; }
        public virtual DbSet<T_Project_Class> T_Project_Class { get; set; }
        public virtual DbSet<T_ProJect_ImaGe> T_ProJect_ImaGe { get; set; }
        public virtual DbSet<T_Project_Pass> T_Project_Pass { get; set; }
        public virtual DbSet<T_Project_Review> T_Project_Review { get; set; }
        public virtual DbSet<T_ProJect_SucceeD> T_ProJect_SucceeD { get; set; }
        public virtual DbSet<T_Project_Support> T_Project_Support { get; set; }
        public virtual DbSet<T_Project_Update> T_Project_Update { get; set; }
        public virtual DbSet<T_User> T_User { get; set; }
        public virtual DbSet<T_User_MoDe> T_User_MoDe { get; set; }

        //protected override void OnModelCreating(ModelBuilder modelBuilder)
        //{
            //modelBuilder.Entity<T_Accomplish>().Property()

            //modelBuilder.Entity<T_Administrator_User>()
            //    .Property(e => e.Intro)
            //    .IsFixedLength();

            //modelBuilder.Entity<T_Administrator_User>()
            //    .HasOptional(e => e.T_Administrator_User1)
            //    .WithRequired(e => e.T_Administrator_User2);

            //modelBuilder.Entity<T_Project>()
            //    .HasMany(e => e.T_ProJect_ImaGe)
            //    .WithRequired(e => e.T_Project)
            //    .HasForeignKey(e => e.ProJect_ID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_Project>()
            //    .HasMany(e => e.T_ProJect_SucceeD)
            //    .WithRequired(e => e.T_Project)
            //    .HasForeignKey(e => e.ProJect_ID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_Project_Class>()
            //    .HasMany(e => e.T_Project)
            //    .WithRequired(e => e.T_Project_Class)
            //    .HasForeignKey(e => e.project_Class)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_Project_Pass>()
            //    .HasMany(e => e.T_Project)
            //    .WithRequired(e => e.T_Project_Pass)
            //    .HasForeignKey(e => e.Project_Status)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_User>()
            //    .HasMany(e => e.T_Information)
            //    .WithRequired(e => e.T_User)
            //    .HasForeignKey(e => e.UserID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_User>()
            //    .HasMany(e => e.T_Project)
            //    .WithRequired(e => e.T_User)
            //    .HasForeignKey(e => e.UserID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_User>()
            //    .HasMany(e => e.T_Project_Review)
            //    .WithRequired(e => e.T_User)
            //    .HasForeignKey(e => e.UserID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_User>()
            //    .HasMany(e => e.T_Project_Support)
            //    .WithRequired(e => e.T_User)
            //    .HasForeignKey(e => e.UserID)
            //    .WillCascadeOnDelete(false);

            //modelBuilder.Entity<T_User_MoDe>()
            //    .HasMany(e => e.T_User)
            //    .HasForeignKey(e => e.User_modeID)
            //    .WillCascadeOnDelete(false);
        //}
    }
}
